<template>
  <el-dialog
    title="详情"
    append-to-body
    :visible.sync="dialogVisible"
    width="500px"
  >
    <el-form :model="form" ref="form" :rules="rules" label-width="130px" size="mini">
      <el-form-item label="区域：" prop="areaId">
        <dx-cascader :area_id.sync="form.areaId" ref="cascader" width="230px" />
      </el-form-item>
      <el-form-item label="账期：" prop="acctMonth">
        <el-date-picker
          v-model="form.acctMonth"
          type="year"
          placeholder="选择账期"
          value-format="yyyy"
          :clearable="false"
          style="width: 230px"
        ></el-date-picker>
      </el-form-item>
    </el-form>
    <div slot="footer">
      <div class="dialog-footer">
        <el-button size="mini" type="primary" @click="handle_submit">确定</el-button>
        <el-button size="mini" @click="dialogVisible = false">取消</el-button>
      </div>
    </div>
  </el-dialog>
</template>
<script>
export default {
  data(){
    return {
      dialogVisible: false,
      form: {
        areaId: null,
        acctMonth: null,
      },
      rules: {
        areaId: [{required: true, message: '必填', trigger: "blur"}],
        acctMonth: [{required: true, message: '必填', trigger: "blur"}],
      }
    }
  },
  methods: {
    show(){
      this.dialogVisible = true;
    },
    async handle_submit() {
      await this.$refs["form"].validate();
      this.$router.push({
        name: 'budgetMakingDetail',
        query: { ...this.form }
      })
    }
  }
}
</script>